<template>
	<el-dialog  
		:visible.sync="selectItemShow"
		 @close="$emit('update:showSelectItem',false)"
		 width="55%" 
		 :show-close='false' 
		 :append-to-body='true'>
		<span slot="title" class="dialog-title">
		  	选项保养项
			<el-button  size="mini" class="popupClose" @click="$emit('update:showSelectItem',false)">关闭</el-button>
			  </span>
			  <!--{{selectItemData}}-->
			  
			 <el-table
                    :data="selectItemData"
                    
                    size='mini'
                    :height='biaoyangTableHeight'
                    @row-dblclick="dblclick"
                    @selection-change="handleSelectionChange"
                    style="width: 100%; margin-top: 20px;">
                        <el-table-column
                          type="selection"
                          width="55">
                        </el-table-column>
                        <el-table-column
                          prop="content"
                          min-width="100"
                          show-overflow-tooltip
                          label="物资编号">
                        </el-table-column>
                        <!--<el-table-column
                          prop="materialName"
                          label="物资名称"
                          min-width="180">
                        </el-table-column>
                          <el-table-column
                          prop="batch"
                          min-width="100"
                          label="物资批号">
                        </el-table-column>
                        <el-table-column
                          prop="materialTypeName"
                          label="物资类型"
                          min-width="180">
                        </el-table-column>
                        <el-table-column
                          prop="spce"
                          label="包装规格">
                        </el-table-column>        
                         <el-table-column
                          prop="purity"
                          label="浓度/纯度">
                        </el-table-column>                       
                        <el-table-column
                          prop="qty"
                          label="库存余量">
                        </el-table-column>-->
                  </el-table>
                  
          <span slot="footer" class="dialog-footer" >
			    <el-button type="primary" @click="queding" size="mini">确 定</el-button>
			    <el-button  size="mini" @click="close">取 消</el-button>
			  </span>
	</el-dialog>
</template>

<script>
	export default {
		props:['showSelectItem','selectItemData'],
		data(){
			return {
				multipleSelection:[],
			}
		},
		computed:{
			selectItemShow:{
			    get: function () {   
			      return this.showSelectItem
				},
			    set: function (newValue) {
	 
			    }
			},
			biaoyangTableHeight(){
		      return ((window.innerHeight - 90)*0.7 - 250)
		    }
		},
		created(){
			
		},
		methods:{
		close(){
	      this.$emit('update:showSelectItem',false)
	    },
		 queding(){   
		  this.multipleSelection.forEach(item=>{
	      	console.log(item)
	      	item.itemContent =item.content
	      })
    	let addArr = this.util.repeatData({old:this.$parent.tableData,new:this.multipleSelection,unique:'id'})
	    this.$parent.tableData = addArr;
	   	this.close();
	    },
			dblclick(row, column, event){
	    	this.multipleSelection = [row];
	    	this.queding()
	    },
	      handleSelectionChange(val) {
	      this.multipleSelection = val;
	     
	    },
		}
	}
</script>

<style>
</style>